/*
 * TestFul - http://code.google.com/p/testful/
 * Copyright (C) 2011 Matteo Miraz
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package testful.regression;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;
import java.io.Serializable;
import java.util.Map.Entry;

import testful.GenericTestCase;
import testful.IConfigProject;
import testful.model.AssignPrimitive;
import testful.model.CreateObject;
import testful.model.Invoke;
import testful.model.Operation;
import testful.model.OperationResult;
import testful.model.OperationResult.Value;
import testful.model.OperationResultTestExecutor;
import testful.model.Reference;
import testful.model.Test;
import testful.runner.RemoteClassLoader;
import testful.testCut.TestRegressionDummyCUT;
import testful.utils.SimpleEntry;

/**
 * Test the jUnit test generation
 * @author matteo
 */
public class JUnitTestGeneratorTestCase extends GenericTestCase {

	private IConfigProject config;

	private File genDir;

	@Override
	public void setUp() throws Exception {
		config = getConfig();

		genDir = new File(config.getDirBase(), "genJUnit");
		assertFalse("delete directory " + genDir.getAbsolutePath(), genDir.exists());
		genDir.mkdirs();
	}

	@Override
	public void tearDown() throws Exception {
		delete(genDir);
	}

	public void testConstructor() throws Exception {
		TestRegressionDummyCUT cut = new TestRegressionDummyCUT();
		Test test = new Test(cut.cluster, cut.refFactory, new Operation[] {
				new CreateObject(cut.cuts[0], cut.cns, new Reference[] { }),
		});

		OperationResult.insert(test.getTest());
		OperationResultTestExecutor.execute(getFinder(), test, true);

		assertEquals(1, test.getTest().length);
		verifySuccessful(test.getTest()[0], null, new Entry[] {
			new SimpleEntry<String, Serializable>("isBoolean", false),
			new SimpleEntry<String, Serializable>("getByte", (byte) 0),
			new SimpleEntry<String, Serializable>("getChar", (char) 0),
			new SimpleEntry<String, Serializable>("getShort", (short) 0),
			new SimpleEntry<String, Serializable>("getInt", 0),
			new SimpleEntry<String, Serializable>("getLong", (long) 0),
			new SimpleEntry<String, Serializable>("getFloat", (float) 0),
			new SimpleEntry<String, Serializable>("getDouble", (double) 0),
			new SimpleEntry<String, Serializable>("getString", null),
		});


		JUnitTestGenerator junit = new JUnitTestGenerator(genDir, new RemoteClassLoader(getFinder()), false);
		junit.read("foo", test);
		junit.writeSuite();

		assertEquals("package test.regression;\n" +
				"\n" +
				"/** Test Generated by TestFul */\n" +
				"public class Dummy_TestCase extends junit.framework.TestCase {\n" +
				"\n" +
				"	// Binary test: foo\n" +
				"	public void testFul1() throws Exception {\n" +
				"\n" +
				"		test.regression.Dummy test_regression_Dummy_0 = null;\n" +
				"\n" +
				"		test_regression_Dummy_0 = new test.regression.Dummy();\n" +
				"		assertEquals(0, (short)test_regression_Dummy_0.getShort());\n" +
				"		assertEquals(0.0, (double)test_regression_Dummy_0.getDouble(), 0.001);\n" +
				"		assertEquals(0, (int)test_regression_Dummy_0.getInt());\n" +
				"		assertEquals(0, (byte)test_regression_Dummy_0.getByte());\n" +
				"		assertEquals(false, (boolean)test_regression_Dummy_0.isBoolean());\n" +
				"		assertEquals('\\u0000', (char)test_regression_Dummy_0.getChar());\n" +
				"		assertNull(test_regression_Dummy_0.getString());\n" +
				"		assertEquals(0l, (long)test_regression_Dummy_0.getLong());\n" +
				"		assertEquals(0.0, (float)test_regression_Dummy_0.getFloat(), 0.001);\n" +
				"\n" +
				"	}\n" +
				"}\n\n",
				readFile(new File(genDir, "test/regression/Dummy_TestCase.java"))
		);
	}

	public void testBoolean() throws Exception {
		TestRegressionDummyCUT cut = new TestRegressionDummyCUT();
		Test test = new Test(cut.cluster, cut.refFactory, new Operation[] {
				new CreateObject(cut.cuts[0], cut.cns, new Reference[] { }),

				new AssignPrimitive(cut.bools[0], true),
				new Invoke(null, cut.cuts[0], cut.setBoolean, new Reference[] { cut.bools[0] }),

				new Invoke(cut.bools[1], cut.cuts[0], cut.isBoolean, new Reference[] { })
		});

		OperationResult.insert(test.getTest());
		OperationResultTestExecutor.execute(getFinder(), test, true);

		assertEquals(4, test.getTest().length);
		verifySuccessful(test.getTest()[0], null, new Entry[] {
			new SimpleEntry<String, Serializable>("isBoolean", false),
			new SimpleEntry<String, Serializable>("getByte", (byte) 0),
			new SimpleEntry<String, Serializable>("getChar", (char) 0),
			new SimpleEntry<String, Serializable>("getShort", (short) 0),
			new SimpleEntry<String, Serializable>("getInt", 0),
			new SimpleEntry<String, Serializable>("getLong", (long) 0),
			new SimpleEntry<String, Serializable>("getFloat", (float) 0),
			new SimpleEntry<String, Serializable>("getDouble", (double) 0),
			new SimpleEntry<String, Serializable>("getString", null),
		});

		assertNull(test.getTest()[1].getInfo(OperationResult.KEY));
		verifySuccessful(test.getTest()[2], new Entry[] {
			new SimpleEntry<String, Serializable>("isBoolean", true),
			new SimpleEntry<String, Serializable>("getByte", (byte) 0),
			new SimpleEntry<String, Serializable>("getChar", (char) 0),
			new SimpleEntry<String, Serializable>("getShort", (short) 0),
			new SimpleEntry<String, Serializable>("getInt", 0),
			new SimpleEntry<String, Serializable>("getLong", (long) 0),
			new SimpleEntry<String, Serializable>("getFloat", (float) 0),
			new SimpleEntry<String, Serializable>("getDouble", (double) 0),
			new SimpleEntry<String, Serializable>("getString", null),
		}, null);

		verifySuccessful(test.getTest()[3], new Entry[] {
			new SimpleEntry<String, Serializable>("isBoolean", true),
			new SimpleEntry<String, Serializable>("getByte", (byte) 0),
			new SimpleEntry<String, Serializable>("getChar", (char) 0),
			new SimpleEntry<String, Serializable>("getShort", (short) 0),
			new SimpleEntry<String, Serializable>("getInt", 0),
			new SimpleEntry<String, Serializable>("getLong", (long) 0),
			new SimpleEntry<String, Serializable>("getFloat", (float) 0),
			new SimpleEntry<String, Serializable>("getDouble", (double) 0),
			new SimpleEntry<String, Serializable>("getString", null),
		}, true);

		JUnitTestGenerator junit = new JUnitTestGenerator(genDir, new RemoteClassLoader(getFinder()), false);
		junit.read("foo", test);
		junit.writeSuite();

		assertEquals("package test.regression;\n" +
				"\n" +
				"/** Test Generated by TestFul */\n" +
				"public class Dummy_TestCase extends junit.framework.TestCase {\n" +
				"\n" +
				"	// Binary test: foo\n" +
				"	public void testFul1() throws Exception {\n" +
				"\n" +
				"		java.lang.Boolean java_lang_Boolean_0 = null, java_lang_Boolean_1 = null;\n" +
				"		test.regression.Dummy test_regression_Dummy_0 = null;\n" +
				"\n" +
				"		java_lang_Boolean_0 = (boolean)true;\n" +
				"		test_regression_Dummy_0 = new test.regression.Dummy();\n" +
				"		assertEquals(0, (short)test_regression_Dummy_0.getShort());\n" +
				"		assertEquals(0.0, (double)test_regression_Dummy_0.getDouble(), 0.001);\n" +
				"		assertEquals(0, (int)test_regression_Dummy_0.getInt());\n" +
				"		assertEquals(0, (byte)test_regression_Dummy_0.getByte());\n" +
				"		assertEquals(false, (boolean)test_regression_Dummy_0.isBoolean());\n" +
				"		assertEquals('\\u0000', (char)test_regression_Dummy_0.getChar());\n" +
				"		assertNull(test_regression_Dummy_0.getString());\n" +
				"		assertEquals(0l, (long)test_regression_Dummy_0.getLong());\n" +
				"		assertEquals(0.0, (float)test_regression_Dummy_0.getFloat(), 0.001);\n" +
				"\n" +
				"		test_regression_Dummy_0.setBoolean(java_lang_Boolean_0);\n" +
				"		assertEquals(0, (short)test_regression_Dummy_0.getShort());\n" +
				"		assertEquals(0.0, (double)test_regression_Dummy_0.getDouble(), 0.001);\n" +
				"		assertEquals(0, (int)test_regression_Dummy_0.getInt());\n" +
				"		assertEquals(0, (byte)test_regression_Dummy_0.getByte());\n" +
				"		assertEquals(true, (boolean)test_regression_Dummy_0.isBoolean());\n" +
				"		assertEquals('\\u0000', (char)test_regression_Dummy_0.getChar());\n" +
				"		assertNull(test_regression_Dummy_0.getString());\n" +
				"		assertEquals(0l, (long)test_regression_Dummy_0.getLong());\n" +
				"		assertEquals(0.0, (float)test_regression_Dummy_0.getFloat(), 0.001);\n" +
				"\n" +
				"		boolean tmp0 = test_regression_Dummy_0.isBoolean();\n" +
				"		assertEquals(true, tmp0);\n" +
				"		assertEquals(0, (short)test_regression_Dummy_0.getShort());\n" +
				"		assertEquals(0.0, (double)test_regression_Dummy_0.getDouble(), 0.001);\n" +
				"		assertEquals(0, (int)test_regression_Dummy_0.getInt());\n" +
				"		assertEquals(0, (byte)test_regression_Dummy_0.getByte());\n" +
				"		assertEquals(true, (boolean)test_regression_Dummy_0.isBoolean());\n" +
				"		assertEquals('\\u0000', (char)test_regression_Dummy_0.getChar());\n" +
				"		assertNull(test_regression_Dummy_0.getString());\n" +
				"		assertEquals(0l, (long)test_regression_Dummy_0.getLong());\n" +
				"		assertEquals(0.0, (float)test_regression_Dummy_0.getFloat(), 0.001);\n" +
				"\n" +
				"	}\n" +
				"}\n\n",
				readFile(new File(genDir, "test/regression/Dummy_TestCase.java"))
		);
	}

	public void testByte() throws Exception {
		TestRegressionDummyCUT cut = new TestRegressionDummyCUT();
		Test test = new Test(cut.cluster, cut.refFactory, new Operation[] {
				new CreateObject(cut.cuts[0], cut.cns, new Reference[] { }),

				new AssignPrimitive(cut.bytes[0], (byte) 1),
				new Invoke(null, cut.cuts[0], cut.setByte, new Reference[] { cut.bytes[0] }),

				new Invoke(cut.bytes[1], cut.cuts[0], cut.getByte, new Reference[] { })
		});

		OperationResult.insert(test.getTest());
		OperationResultTestExecutor.execute(getFinder(), test, true);

		assertEquals(4, test.getTest().length);
		verifySuccessful(test.getTest()[0], null, new Entry[] {
			new SimpleEntry<String, Serializable>("isBoolean", false),
			new SimpleEntry<String, Serializable>("getByte", (byte) 0),
			new SimpleEntry<String, Serializable>("getChar", (char) 0),
			new SimpleEntry<String, Serializable>("getShort", (short) 0),
			new SimpleEntry<String, Serializable>("getInt", 0),
			new SimpleEntry<String, Serializable>("getLong", (long) 0),
			new SimpleEntry<String, Serializable>("getFloat", (float) 0),
			new SimpleEntry<String, Serializable>("getDouble", (double) 0),
			new SimpleEntry<String, Serializable>("getString", null),
		});

		assertNull(test.getTest()[1].getInfo(OperationResult.KEY));
		verifySuccessful(test.getTest()[2], new Entry[] {
			new SimpleEntry<String, Serializable>("isBoolean", false),
			new SimpleEntry<String, Serializable>("getByte", (byte) 1),
			new SimpleEntry<String, Serializable>("getChar", (char) 0),
			new SimpleEntry<String, Serializable>("getShort", (short) 0),
			new SimpleEntry<String, Serializable>("getInt", 0),
			new SimpleEntry<String, Serializable>("getLong", (long) 0),
			new SimpleEntry<String, Serializable>("getFloat", (float) 0),
			new SimpleEntry<String, Serializable>("getDouble", (double) 0),
			new SimpleEntry<String, Serializable>("getString", null),
		}, null);

		verifySuccessful(test.getTest()[3], new Entry[] {
			new SimpleEntry<String, Serializable>("isBoolean", false),
			new SimpleEntry<String, Serializable>("getByte", (byte) 1),
			new SimpleEntry<String, Serializable>("getChar", (char) 0),
			new SimpleEntry<String, Serializable>("getShort", (short) 0),
			new SimpleEntry<String, Serializable>("getInt", 0),
			new SimpleEntry<String, Serializable>("getLong", (long) 0),
			new SimpleEntry<String, Serializable>("getFloat", (float) 0),
			new SimpleEntry<String, Serializable>("getDouble", (double) 0),
			new SimpleEntry<String, Serializable>("getString", null),
		}, (byte) 1);

		JUnitTestGenerator junit = new JUnitTestGenerator(genDir, new RemoteClassLoader(getFinder()), false);
		junit.read("foo", test);
		junit.writeSuite();

		assertEquals("package test.regression;\n" +
				"\n" +
				"/** Test Generated by TestFul */\n" +
				"public class Dummy_TestCase extends junit.framework.TestCase {\n" +
				"\n" +
				"	// Binary test: foo\n" +
				"	public void testFul1() throws Exception {\n" +
				"\n" +
				"		test.regression.Dummy test_regression_Dummy_0 = null;\n" +
				"		java.lang.Byte java_lang_Byte_0 = null, java_lang_Byte_1 = null;\n" +
				"\n" +
				"		java_lang_Byte_0 = (byte)1;\n" +
				"		test_regression_Dummy_0 = new test.regression.Dummy();\n" +
				"		assertEquals(0, (short)test_regression_Dummy_0.getShort());\n" +
				"		assertEquals(0.0, (double)test_regression_Dummy_0.getDouble(), 0.001);\n" +
				"		assertEquals(0, (int)test_regression_Dummy_0.getInt());\n" +
				"		assertEquals(0, (byte)test_regression_Dummy_0.getByte());\n" +
				"		assertEquals(false, (boolean)test_regression_Dummy_0.isBoolean());\n" +
				"		assertEquals('\\u0000', (char)test_regression_Dummy_0.getChar());\n" +
				"		assertNull(test_regression_Dummy_0.getString());\n" +
				"		assertEquals(0l, (long)test_regression_Dummy_0.getLong());\n" +
				"		assertEquals(0.0, (float)test_regression_Dummy_0.getFloat(), 0.001);\n" +
				"\n" +
				"		test_regression_Dummy_0.setByte(java_lang_Byte_0);\n" +
				"		assertEquals(0, (short)test_regression_Dummy_0.getShort());\n" +
				"		assertEquals(0.0, (double)test_regression_Dummy_0.getDouble(), 0.001);\n" +
				"		assertEquals(0, (int)test_regression_Dummy_0.getInt());\n" +
				"		assertEquals(1, (byte)test_regression_Dummy_0.getByte());\n" +
				"		assertEquals(false, (boolean)test_regression_Dummy_0.isBoolean());\n" +
				"		assertEquals('\\u0000', (char)test_regression_Dummy_0.getChar());\n" +
				"		assertNull(test_regression_Dummy_0.getString());\n" +
				"		assertEquals(0l, (long)test_regression_Dummy_0.getLong());\n" +
				"		assertEquals(0.0, (float)test_regression_Dummy_0.getFloat(), 0.001);\n" +
				"\n" +
				"		byte tmp0 = test_regression_Dummy_0.getByte();\n" +
				"		assertEquals(1, tmp0);\n" +
				"		assertEquals(0, (short)test_regression_Dummy_0.getShort());\n" +
				"		assertEquals(0.0, (double)test_regression_Dummy_0.getDouble(), 0.001);\n" +
				"		assertEquals(0, (int)test_regression_Dummy_0.getInt());\n" +
				"		assertEquals(1, (byte)test_regression_Dummy_0.getByte());\n" +
				"		assertEquals(false, (boolean)test_regression_Dummy_0.isBoolean());\n" +
				"		assertEquals('\\u0000', (char)test_regression_Dummy_0.getChar());\n" +
				"		assertNull(test_regression_Dummy_0.getString());\n" +
				"		assertEquals(0l, (long)test_regression_Dummy_0.getLong());\n" +
				"		assertEquals(0.0, (float)test_regression_Dummy_0.getFloat(), 0.001);\n" +
				"\n" +
				"	}\n" +
				"}\n\n",
				readFile(new File(genDir, "test/regression/Dummy_TestCase.java"))
		);
	}

	public void testChar() throws Exception {
		TestRegressionDummyCUT cut = new TestRegressionDummyCUT();
		Test test = new Test(cut.cluster, cut.refFactory, new Operation[] {
				new CreateObject(cut.cuts[0], cut.cns, new Reference[] { }),

				new AssignPrimitive(cut.chars[0], 'a'),
				new Invoke(null, cut.cuts[0], cut.setChar, new Reference[] { cut.chars[0] }),

				new Invoke(cut.chars[1], cut.cuts[0], cut.getChar, new Reference[] { })
		});

		OperationResult.insert(test.getTest());
		OperationResultTestExecutor.execute(getFinder(), test, true);

		assertEquals(4, test.getTest().length);
		verifySuccessful(test.getTest()[0], null, new Entry[] {
			new SimpleEntry<String, Serializable>("isBoolean", false),
			new SimpleEntry<String, Serializable>("getByte", (byte) 0),
			new SimpleEntry<String, Serializable>("getChar", (char) 0),
			new SimpleEntry<String, Serializable>("getShort", (short) 0),
			new SimpleEntry<String, Serializable>("getInt", 0),
			new SimpleEntry<String, Serializable>("getLong", (long) 0),
			new SimpleEntry<String, Serializable>("getFloat", (float) 0),
			new SimpleEntry<String, Serializable>("getDouble", (double) 0),
			new SimpleEntry<String, Serializable>("getString", null),
		});

		assertNull(test.getTest()[1].getInfo(OperationResult.KEY));
		verifySuccessful(test.getTest()[2], new Entry[] {
			new SimpleEntry<String, Serializable>("isBoolean", false),
			new SimpleEntry<String, Serializable>("getByte", (byte) 0),
			new SimpleEntry<String, Serializable>("getChar", 'a'),
			new SimpleEntry<String, Serializable>("getShort", (short) 0),
			new SimpleEntry<String, Serializable>("getInt", 0),
			new SimpleEntry<String, Serializable>("getLong", (long) 0),
			new SimpleEntry<String, Serializable>("getFloat", (float) 0),
			new SimpleEntry<String, Serializable>("getDouble", (double) 0),
			new SimpleEntry<String, Serializable>("getString", null),
		}, null);

		verifySuccessful(test.getTest()[3], new Entry[] {
			new SimpleEntry<String, Serializable>("isBoolean", false),
			new SimpleEntry<String, Serializable>("getByte", (byte) 0),
			new SimpleEntry<String, Serializable>("getChar", 'a'),
			new SimpleEntry<String, Serializable>("getShort", (short) 0),
			new SimpleEntry<String, Serializable>("getInt", 0),
			new SimpleEntry<String, Serializable>("getLong", (long) 0),
			new SimpleEntry<String, Serializable>("getFloat", (float) 0),
			new SimpleEntry<String, Serializable>("getDouble", (double) 0),
			new SimpleEntry<String, Serializable>("getString", null),
		}, 'a');

		JUnitTestGenerator junit = new JUnitTestGenerator(genDir, new RemoteClassLoader(getFinder()), false);
		junit.read("foo", test);
		junit.writeSuite();

		assertEquals("package test.regression;\n" +
				"\n" +
				"/** Test Generated by TestFul */\n" +
				"public class Dummy_TestCase extends junit.framework.TestCase {\n" +
				"\n" +
				"	// Binary test: foo\n" +
				"	public void testFul1() throws Exception {\n" +
				"\n" +
				"		java.lang.Character java_lang_Character_0 = null, java_lang_Character_1 = null;\n" +
				"		test.regression.Dummy test_regression_Dummy_0 = null;\n" +
				"\n" +
				"		java_lang_Character_0 = (char)'a';\n" +
				"		test_regression_Dummy_0 = new test.regression.Dummy();\n" +
				"		assertEquals(0, (short)test_regression_Dummy_0.getShort());\n" +
				"		assertEquals(0.0, (double)test_regression_Dummy_0.getDouble(), 0.001);\n" +
				"		assertEquals(0, (int)test_regression_Dummy_0.getInt());\n" +
				"		assertEquals(0, (byte)test_regression_Dummy_0.getByte());\n" +
				"		assertEquals(false, (boolean)test_regression_Dummy_0.isBoolean());\n" +
				"		assertEquals('\\u0000', (char)test_regression_Dummy_0.getChar());\n" +
				"		assertNull(test_regression_Dummy_0.getString());\n" +
				"		assertEquals(0l, (long)test_regression_Dummy_0.getLong());\n" +
				"		assertEquals(0.0, (float)test_regression_Dummy_0.getFloat(), 0.001);\n" +
				"\n" +
				"		test_regression_Dummy_0.setChar(java_lang_Character_0);\n" +
				"		assertEquals(0, (short)test_regression_Dummy_0.getShort());\n" +
				"		assertEquals(0.0, (double)test_regression_Dummy_0.getDouble(), 0.001);\n" +
				"		assertEquals(0, (int)test_regression_Dummy_0.getInt());\n" +
				"		assertEquals(0, (byte)test_regression_Dummy_0.getByte());\n" +
				"		assertEquals(false, (boolean)test_regression_Dummy_0.isBoolean());\n" +
				"		assertEquals('a', (char)test_regression_Dummy_0.getChar());\n" +
				"		assertNull(test_regression_Dummy_0.getString());\n" +
				"		assertEquals(0l, (long)test_regression_Dummy_0.getLong());\n" +
				"		assertEquals(0.0, (float)test_regression_Dummy_0.getFloat(), 0.001);\n" +
				"\n" +
				"		char tmp0 = test_regression_Dummy_0.getChar();\n" +
				"		assertEquals('a', tmp0);\n" +
				"		assertEquals(0, (short)test_regression_Dummy_0.getShort());\n" +
				"		assertEquals(0.0, (double)test_regression_Dummy_0.getDouble(), 0.001);\n" +
				"		assertEquals(0, (int)test_regression_Dummy_0.getInt());\n" +
				"		assertEquals(0, (byte)test_regression_Dummy_0.getByte());\n" +
				"		assertEquals(false, (boolean)test_regression_Dummy_0.isBoolean());\n" +
				"		assertEquals('a', (char)test_regression_Dummy_0.getChar());\n" +
				"		assertNull(test_regression_Dummy_0.getString());\n" +
				"		assertEquals(0l, (long)test_regression_Dummy_0.getLong());\n" +
				"		assertEquals(0.0, (float)test_regression_Dummy_0.getFloat(), 0.001);\n" +
				"\n" +
				"	}\n" +
				"}\n\n",
				readFile(new File(genDir, "test/regression/Dummy_TestCase.java"))
		);
	}

	public void testShort() throws Exception {
		TestRegressionDummyCUT cut = new TestRegressionDummyCUT();
		Test test = new Test(cut.cluster, cut.refFactory, new Operation[] {
				new CreateObject(cut.cuts[0], cut.cns, new Reference[] { }),

				new AssignPrimitive(cut.shorts[0], (short) 1),
				new Invoke(null, cut.cuts[0], cut.setShort, new Reference[] { cut.shorts[0] }),

				new Invoke(cut.shorts[1], cut.cuts[0], cut.getShort, new Reference[] { })
		});

		OperationResult.insert(test.getTest());
		OperationResultTestExecutor.execute(getFinder(), test, true);

		assertEquals(4, test.getTest().length);
		verifySuccessful(test.getTest()[0], null, new Entry[] {
			new SimpleEntry<String, Serializable>("isBoolean", false),
			new SimpleEntry<String, Serializable>("getByte", (byte) 0),
			new SimpleEntry<String, Serializable>("getChar", (char) 0),
			new SimpleEntry<String, Serializable>("getShort", (short) 0),
			new SimpleEntry<String, Serializable>("getInt", 0),
			new SimpleEntry<String, Serializable>("getLong", (long) 0),
			new SimpleEntry<String, Serializable>("getFloat", (float) 0),
			new SimpleEntry<String, Serializable>("getDouble", (double) 0),
			new SimpleEntry<String, Serializable>("getString", null),
		});

		assertNull(test.getTest()[1].getInfo(OperationResult.KEY));
		verifySuccessful(test.getTest()[2], new Entry[] {
			new SimpleEntry<String, Serializable>("isBoolean", false),
			new SimpleEntry<String, Serializable>("getByte", (byte) 0),
			new SimpleEntry<String, Serializable>("getChar", (char) 0),
			new SimpleEntry<String, Serializable>("getShort", (short) 1),
			new SimpleEntry<String, Serializable>("getInt", 0),
			new SimpleEntry<String, Serializable>("getLong", (long) 0),
			new SimpleEntry<String, Serializable>("getFloat", (float) 0),
			new SimpleEntry<String, Serializable>("getDouble", (double) 0),
			new SimpleEntry<String, Serializable>("getString", null),
		}, null);

		verifySuccessful(test.getTest()[3], new Entry[] {
			new SimpleEntry<String, Serializable>("isBoolean", false),
			new SimpleEntry<String, Serializable>("getByte", (byte) 0),
			new SimpleEntry<String, Serializable>("getChar", (char) 0),
			new SimpleEntry<String, Serializable>("getShort", (short) 1),
			new SimpleEntry<String, Serializable>("getInt", 0),
			new SimpleEntry<String, Serializable>("getLong", (long) 0),
			new SimpleEntry<String, Serializable>("getFloat", (float) 0),
			new SimpleEntry<String, Serializable>("getDouble", (double) 0),
			new SimpleEntry<String, Serializable>("getString", null),
		}, (short) 1);

		JUnitTestGenerator junit = new JUnitTestGenerator(genDir, new RemoteClassLoader(getFinder()), false);
		junit.read("foo", test);
		junit.writeSuite();

		assertEquals("package test.regression;\n" +
				"\n" +
				"/** Test Generated by TestFul */\n" +
				"public class Dummy_TestCase extends junit.framework.TestCase {\n" +
				"\n" +
				"	// Binary test: foo\n" +
				"	public void testFul1() throws Exception {\n" +
				"\n" +
				"		test.regression.Dummy test_regression_Dummy_0 = null;\n" +
				"		java.lang.Short java_lang_Short_0 = null, java_lang_Short_1 = null;\n" +
				"\n" +
				"		java_lang_Short_0 = (short)1;\n" +
				"		test_regression_Dummy_0 = new test.regression.Dummy();\n" +
				"		assertEquals(0, (short)test_regression_Dummy_0.getShort());\n" +
				"		assertEquals(0.0, (double)test_regression_Dummy_0.getDouble(), 0.001);\n" +
				"		assertEquals(0, (int)test_regression_Dummy_0.getInt());\n" +
				"		assertEquals(0, (byte)test_regression_Dummy_0.getByte());\n" +
				"		assertEquals(false, (boolean)test_regression_Dummy_0.isBoolean());\n" +
				"		assertEquals('\\u0000', (char)test_regression_Dummy_0.getChar());\n" +
				"		assertNull(test_regression_Dummy_0.getString());\n" +
				"		assertEquals(0l, (long)test_regression_Dummy_0.getLong());\n" +
				"		assertEquals(0.0, (float)test_regression_Dummy_0.getFloat(), 0.001);\n" +
				"\n" +
				"		test_regression_Dummy_0.setShort(java_lang_Short_0);\n" +
				"		assertEquals(1, (short)test_regression_Dummy_0.getShort());\n" +
				"		assertEquals(0.0, (double)test_regression_Dummy_0.getDouble(), 0.001);\n" +
				"		assertEquals(0, (int)test_regression_Dummy_0.getInt());\n" +
				"		assertEquals(0, (byte)test_regression_Dummy_0.getByte());\n" +
				"		assertEquals(false, (boolean)test_regression_Dummy_0.isBoolean());\n" +
				"		assertEquals('\\u0000', (char)test_regression_Dummy_0.getChar());\n" +
				"		assertNull(test_regression_Dummy_0.getString());\n" +
				"		assertEquals(0l, (long)test_regression_Dummy_0.getLong());\n" +
				"		assertEquals(0.0, (float)test_regression_Dummy_0.getFloat(), 0.001);\n" +
				"\n" +
				"		short tmp0 = test_regression_Dummy_0.getShort();\n" +
				"		assertEquals(1, tmp0);\n" +
				"		assertEquals(1, (short)test_regression_Dummy_0.getShort());\n" +
				"		assertEquals(0.0, (double)test_regression_Dummy_0.getDouble(), 0.001);\n" +
				"		assertEquals(0, (int)test_regression_Dummy_0.getInt());\n" +
				"		assertEquals(0, (byte)test_regression_Dummy_0.getByte());\n" +
				"		assertEquals(false, (boolean)test_regression_Dummy_0.isBoolean());\n" +
				"		assertEquals('\\u0000', (char)test_regression_Dummy_0.getChar());\n" +
				"		assertNull(test_regression_Dummy_0.getString());\n" +
				"		assertEquals(0l, (long)test_regression_Dummy_0.getLong());\n" +
				"		assertEquals(0.0, (float)test_regression_Dummy_0.getFloat(), 0.001);\n" +
				"\n" +
				"	}\n" +
				"}\n\n",
				readFile(new File(genDir, "test/regression/Dummy_TestCase.java"))
		);
	}

	public void testInt() throws Exception {
		TestRegressionDummyCUT cut = new TestRegressionDummyCUT();
		Test test = new Test(cut.cluster, cut.refFactory, new Operation[] {
				new CreateObject(cut.cuts[0], cut.cns, new Reference[] { }),

				new AssignPrimitive(cut.ints[0], 1),
				new Invoke(null, cut.cuts[0], cut.setInt, new Reference[] { cut.ints[0] }),

				new Invoke(cut.ints[1], cut.cuts[0], cut.getInt, new Reference[] { })
		});

		OperationResult.insert(test.getTest());
		OperationResultTestExecutor.execute(getFinder(), test, true);

		assertEquals(4, test.getTest().length);
		verifySuccessful(test.getTest()[0], null, new Entry[] {
			new SimpleEntry<String, Serializable>("isBoolean", false),
			new SimpleEntry<String, Serializable>("getByte", (byte) 0),
			new SimpleEntry<String, Serializable>("getChar", (char) 0),
			new SimpleEntry<String, Serializable>("getShort", (short) 0),
			new SimpleEntry<String, Serializable>("getInt", 0),
			new SimpleEntry<String, Serializable>("getLong", (long) 0),
			new SimpleEntry<String, Serializable>("getFloat", (float) 0),
			new SimpleEntry<String, Serializable>("getDouble", (double) 0),
			new SimpleEntry<String, Serializable>("getString", null),
		});

		assertNull(test.getTest()[1].getInfo(OperationResult.KEY));
		verifySuccessful(test.getTest()[2], new Entry[] {
			new SimpleEntry<String, Serializable>("isBoolean", false),
			new SimpleEntry<String, Serializable>("getByte", (byte) 0),
			new SimpleEntry<String, Serializable>("getChar", (char) 0),
			new SimpleEntry<String, Serializable>("getShort", (short) 0),
			new SimpleEntry<String, Serializable>("getInt", 1),
			new SimpleEntry<String, Serializable>("getLong", (long) 0),
			new SimpleEntry<String, Serializable>("getFloat", (float) 0),
			new SimpleEntry<String, Serializable>("getDouble", (double) 0),
			new SimpleEntry<String, Serializable>("getString", null),
		}, null);

		verifySuccessful(test.getTest()[3], new Entry[] {
			new SimpleEntry<String, Serializable>("isBoolean", false),
			new SimpleEntry<String, Serializable>("getByte", (byte) 0),
			new SimpleEntry<String, Serializable>("getChar", (char) 0),
			new SimpleEntry<String, Serializable>("getShort", (short) 0),
			new SimpleEntry<String, Serializable>("getInt", 1),
			new SimpleEntry<String, Serializable>("getLong", (long) 0),
			new SimpleEntry<String, Serializable>("getFloat", (float) 0),
			new SimpleEntry<String, Serializable>("getDouble", (double) 0),
			new SimpleEntry<String, Serializable>("getString", null),
		}, 1);

		JUnitTestGenerator junit = new JUnitTestGenerator(genDir, new RemoteClassLoader(getFinder()), false);
		junit.read("foo", test);
		junit.writeSuite();

		assertEquals("package test.regression;\n" +
				"\n" +
				"/** Test Generated by TestFul */\n" +
				"public class Dummy_TestCase extends junit.framework.TestCase {\n" +
				"\n" +
				"	// Binary test: foo\n" +
				"	public void testFul1() throws Exception {\n" +
				"\n" +
				"		java.lang.Integer java_lang_Integer_0 = null, java_lang_Integer_1 = null;\n" +
				"		test.regression.Dummy test_regression_Dummy_0 = null;\n" +
				"\n" +
				"		java_lang_Integer_0 = (int)1;\n" +
				"		test_regression_Dummy_0 = new test.regression.Dummy();\n" +
				"		assertEquals(0, (short)test_regression_Dummy_0.getShort());\n" +
				"		assertEquals(0.0, (double)test_regression_Dummy_0.getDouble(), 0.001);\n" +
				"		assertEquals(0, (int)test_regression_Dummy_0.getInt());\n" +
				"		assertEquals(0, (byte)test_regression_Dummy_0.getByte());\n" +
				"		assertEquals(false, (boolean)test_regression_Dummy_0.isBoolean());\n" +
				"		assertEquals('\\u0000', (char)test_regression_Dummy_0.getChar());\n" +
				"		assertNull(test_regression_Dummy_0.getString());\n" +
				"		assertEquals(0l, (long)test_regression_Dummy_0.getLong());\n" +
				"		assertEquals(0.0, (float)test_regression_Dummy_0.getFloat(), 0.001);\n" +
				"\n" +
				"		test_regression_Dummy_0.setInt(java_lang_Integer_0);\n" +
				"		assertEquals(0, (short)test_regression_Dummy_0.getShort());\n" +
				"		assertEquals(0.0, (double)test_regression_Dummy_0.getDouble(), 0.001);\n" +
				"		assertEquals(1, (int)test_regression_Dummy_0.getInt());\n" +
				"		assertEquals(0, (byte)test_regression_Dummy_0.getByte());\n" +
				"		assertEquals(false, (boolean)test_regression_Dummy_0.isBoolean());\n" +
				"		assertEquals('\\u0000', (char)test_regression_Dummy_0.getChar());\n" +
				"		assertNull(test_regression_Dummy_0.getString());\n" +
				"		assertEquals(0l, (long)test_regression_Dummy_0.getLong());\n" +
				"		assertEquals(0.0, (float)test_regression_Dummy_0.getFloat(), 0.001);\n" +
				"\n" +
				"		int tmp0 = test_regression_Dummy_0.getInt();\n" +
				"		assertEquals(1, tmp0);\n" +
				"		assertEquals(0, (short)test_regression_Dummy_0.getShort());\n" +
				"		assertEquals(0.0, (double)test_regression_Dummy_0.getDouble(), 0.001);\n" +
				"		assertEquals(1, (int)test_regression_Dummy_0.getInt());\n" +
				"		assertEquals(0, (byte)test_regression_Dummy_0.getByte());\n" +
				"		assertEquals(false, (boolean)test_regression_Dummy_0.isBoolean());\n" +
				"		assertEquals('\\u0000', (char)test_regression_Dummy_0.getChar());\n" +
				"		assertNull(test_regression_Dummy_0.getString());\n" +
				"		assertEquals(0l, (long)test_regression_Dummy_0.getLong());\n" +
				"		assertEquals(0.0, (float)test_regression_Dummy_0.getFloat(), 0.001);\n" +
				"\n" +
				"	}\n" +
				"}\n\n",
				readFile(new File(genDir, "test/regression/Dummy_TestCase.java"))
		);
	}

	public void testLong() throws Exception {
		TestRegressionDummyCUT cut = new TestRegressionDummyCUT();
		Test test = new Test(cut.cluster, cut.refFactory, new Operation[] {
				new CreateObject(cut.cuts[0], cut.cns, new Reference[] { }),

				new AssignPrimitive(cut.longs[0], 1L),
				new Invoke(null, cut.cuts[0], cut.setLong, new Reference[] { cut.longs[0] }),

				new Invoke(cut.longs[1], cut.cuts[0], cut.getLong, new Reference[] { })
		});

		OperationResult.insert(test.getTest());
		OperationResultTestExecutor.execute(getFinder(), test, true);

		assertEquals(4, test.getTest().length);
		verifySuccessful(test.getTest()[0], null, new Entry[] {
			new SimpleEntry<String, Serializable>("isBoolean", false),
			new SimpleEntry<String, Serializable>("getByte", (byte) 0),
			new SimpleEntry<String, Serializable>("getChar", (char) 0),
			new SimpleEntry<String, Serializable>("getShort", (short) 0),
			new SimpleEntry<String, Serializable>("getInt", 0),
			new SimpleEntry<String, Serializable>("getLong", (long) 0),
			new SimpleEntry<String, Serializable>("getFloat", (float) 0),
			new SimpleEntry<String, Serializable>("getDouble", (double) 0),
			new SimpleEntry<String, Serializable>("getString", null),
		});

		assertNull(test.getTest()[1].getInfo(OperationResult.KEY));
		verifySuccessful(test.getTest()[2], new Entry[] {
			new SimpleEntry<String, Serializable>("isBoolean", false),
			new SimpleEntry<String, Serializable>("getByte", (byte) 0),
			new SimpleEntry<String, Serializable>("getChar", (char) 0),
			new SimpleEntry<String, Serializable>("getShort", (short) 0),
			new SimpleEntry<String, Serializable>("getInt", 0),
			new SimpleEntry<String, Serializable>("getLong", 1L),
			new SimpleEntry<String, Serializable>("getFloat", (float) 0),
			new SimpleEntry<String, Serializable>("getDouble", (double) 0),
			new SimpleEntry<String, Serializable>("getString", null),
		}, null);

		verifySuccessful(test.getTest()[3], new Entry[] {
			new SimpleEntry<String, Serializable>("isBoolean", false),
			new SimpleEntry<String, Serializable>("getByte", (byte) 0),
			new SimpleEntry<String, Serializable>("getChar", (char) 0),
			new SimpleEntry<String, Serializable>("getShort", (short) 0),
			new SimpleEntry<String, Serializable>("getInt", 0),
			new SimpleEntry<String, Serializable>("getLong", 1L),
			new SimpleEntry<String, Serializable>("getFloat", (float) 0),
			new SimpleEntry<String, Serializable>("getDouble", (double) 0),
			new SimpleEntry<String, Serializable>("getString", null),
		}, 1L);

		JUnitTestGenerator junit = new JUnitTestGenerator(genDir, new RemoteClassLoader(getFinder()), false);
		junit.read("foo", test);
		junit.writeSuite();

		assertEquals("package test.regression;\n" +
				"\n" +
				"/** Test Generated by TestFul */\n" +
				"public class Dummy_TestCase extends junit.framework.TestCase {\n" +
				"\n" +
				"	// Binary test: foo\n" +
				"	public void testFul1() throws Exception {\n" +
				"\n" +
				"		java.lang.Long java_lang_Long_0 = null, java_lang_Long_1 = null;\n" +
				"		test.regression.Dummy test_regression_Dummy_0 = null;\n" +
				"\n" +
				"		java_lang_Long_0 = (long)1l;\n" +
				"		test_regression_Dummy_0 = new test.regression.Dummy();\n" +
				"		assertEquals(0, (short)test_regression_Dummy_0.getShort());\n" +
				"		assertEquals(0.0, (double)test_regression_Dummy_0.getDouble(), 0.001);\n" +
				"		assertEquals(0, (int)test_regression_Dummy_0.getInt());\n" +
				"		assertEquals(0, (byte)test_regression_Dummy_0.getByte());\n" +
				"		assertEquals(false, (boolean)test_regression_Dummy_0.isBoolean());\n" +
				"		assertEquals('\\u0000', (char)test_regression_Dummy_0.getChar());\n" +
				"		assertNull(test_regression_Dummy_0.getString());\n" +
				"		assertEquals(0l, (long)test_regression_Dummy_0.getLong());\n" +
				"		assertEquals(0.0, (float)test_regression_Dummy_0.getFloat(), 0.001);\n" +
				"\n" +
				"		test_regression_Dummy_0.setLong(java_lang_Long_0);\n" +
				"		assertEquals(0, (short)test_regression_Dummy_0.getShort());\n" +
				"		assertEquals(0.0, (double)test_regression_Dummy_0.getDouble(), 0.001);\n" +
				"		assertEquals(0, (int)test_regression_Dummy_0.getInt());\n" +
				"		assertEquals(0, (byte)test_regression_Dummy_0.getByte());\n" +
				"		assertEquals(false, (boolean)test_regression_Dummy_0.isBoolean());\n" +
				"		assertEquals('\\u0000', (char)test_regression_Dummy_0.getChar());\n" +
				"		assertNull(test_regression_Dummy_0.getString());\n" +
				"		assertEquals(1l, (long)test_regression_Dummy_0.getLong());\n" +
				"		assertEquals(0.0, (float)test_regression_Dummy_0.getFloat(), 0.001);\n" +
				"\n" +
				"		long tmp0 = test_regression_Dummy_0.getLong();\n" +
				"		assertEquals(1l, tmp0);\n" +
				"		assertEquals(0, (short)test_regression_Dummy_0.getShort());\n" +
				"		assertEquals(0.0, (double)test_regression_Dummy_0.getDouble(), 0.001);\n" +
				"		assertEquals(0, (int)test_regression_Dummy_0.getInt());\n" +
				"		assertEquals(0, (byte)test_regression_Dummy_0.getByte());\n" +
				"		assertEquals(false, (boolean)test_regression_Dummy_0.isBoolean());\n" +
				"		assertEquals('\\u0000', (char)test_regression_Dummy_0.getChar());\n" +
				"		assertNull(test_regression_Dummy_0.getString());\n" +
				"		assertEquals(1l, (long)test_regression_Dummy_0.getLong());\n" +
				"		assertEquals(0.0, (float)test_regression_Dummy_0.getFloat(), 0.001);\n" +
				"\n" +
				"	}\n" +
				"}\n\n",
				readFile(new File(genDir, "test/regression/Dummy_TestCase.java"))
		);
	}

	public void testFloat() throws Exception {
		TestRegressionDummyCUT cut = new TestRegressionDummyCUT();
		Test test = new Test(cut.cluster, cut.refFactory, new Operation[] {
				new CreateObject(cut.cuts[0], cut.cns, new Reference[] { }),

				new AssignPrimitive(cut.floats[0], 1.0f),
				new Invoke(null, cut.cuts[0], cut.setFloat, new Reference[] { cut.floats[0] }),

				new Invoke(cut.floats[1], cut.cuts[0], cut.getFloat, new Reference[] { })
		});

		OperationResult.insert(test.getTest());
		OperationResultTestExecutor.execute(getFinder(), test, true);

		assertEquals(4, test.getTest().length);
		verifySuccessful(test.getTest()[0], null, new Entry[] {
			new SimpleEntry<String, Serializable>("isBoolean", false),
			new SimpleEntry<String, Serializable>("getByte", (byte) 0),
			new SimpleEntry<String, Serializable>("getChar", (char) 0),
			new SimpleEntry<String, Serializable>("getShort", (short) 0),
			new SimpleEntry<String, Serializable>("getInt", 0),
			new SimpleEntry<String, Serializable>("getLong", (long) 0),
			new SimpleEntry<String, Serializable>("getFloat", (float) 0),
			new SimpleEntry<String, Serializable>("getDouble", (double) 0),
			new SimpleEntry<String, Serializable>("getString", null),
		});

		assertNull(test.getTest()[1].getInfo(OperationResult.KEY));
		verifySuccessful(test.getTest()[2], new Entry[] {
			new SimpleEntry<String, Serializable>("isBoolean", false),
			new SimpleEntry<String, Serializable>("getByte", (byte) 0),
			new SimpleEntry<String, Serializable>("getChar", (char) 0),
			new SimpleEntry<String, Serializable>("getShort", (short) 0),
			new SimpleEntry<String, Serializable>("getInt", 0),
			new SimpleEntry<String, Serializable>("getLong", (long) 0),
			new SimpleEntry<String, Serializable>("getFloat", 1.0f),
			new SimpleEntry<String, Serializable>("getDouble", (double) 0),
			new SimpleEntry<String, Serializable>("getString", null),
		}, null);

		verifySuccessful(test.getTest()[3], new Entry[] {
			new SimpleEntry<String, Serializable>("isBoolean", false),
			new SimpleEntry<String, Serializable>("getByte", (byte) 0),
			new SimpleEntry<String, Serializable>("getChar", (char) 0),
			new SimpleEntry<String, Serializable>("getShort", (short) 0),
			new SimpleEntry<String, Serializable>("getInt", 0),
			new SimpleEntry<String, Serializable>("getLong", (long) 0),
			new SimpleEntry<String, Serializable>("getFloat", 1.0f),
			new SimpleEntry<String, Serializable>("getDouble", (double) 0),
			new SimpleEntry<String, Serializable>("getString", null),
		}, 1.0f);

		JUnitTestGenerator junit = new JUnitTestGenerator(genDir, new RemoteClassLoader(getFinder()), false);
		junit.read("foo", test);
		junit.writeSuite();

		assertEquals("package test.regression;\n" +
				"\n" +
				"/** Test Generated by TestFul */\n" +
				"public class Dummy_TestCase extends junit.framework.TestCase {\n" +
				"\n" +
				"	// Binary test: foo\n" +
				"	public void testFul1() throws Exception {\n" +
				"\n" +
				"		test.regression.Dummy test_regression_Dummy_0 = null;\n" +
				"		java.lang.Float java_lang_Float_0 = null, java_lang_Float_1 = null;\n" +
				"\n" +
				"		java_lang_Float_0 = (float)1.0;\n" +
				"		test_regression_Dummy_0 = new test.regression.Dummy();\n" +
				"		assertEquals(0, (short)test_regression_Dummy_0.getShort());\n" +
				"		assertEquals(0.0, (double)test_regression_Dummy_0.getDouble(), 0.001);\n" +
				"		assertEquals(0, (int)test_regression_Dummy_0.getInt());\n" +
				"		assertEquals(0, (byte)test_regression_Dummy_0.getByte());\n" +
				"		assertEquals(false, (boolean)test_regression_Dummy_0.isBoolean());\n" +
				"		assertEquals('\\u0000', (char)test_regression_Dummy_0.getChar());\n" +
				"		assertNull(test_regression_Dummy_0.getString());\n" +
				"		assertEquals(0l, (long)test_regression_Dummy_0.getLong());\n" +
				"		assertEquals(0.0, (float)test_regression_Dummy_0.getFloat(), 0.001);\n" +
				"\n" +
				"		test_regression_Dummy_0.setFloat(java_lang_Float_0);\n" +
				"		assertEquals(0, (short)test_regression_Dummy_0.getShort());\n" +
				"		assertEquals(0.0, (double)test_regression_Dummy_0.getDouble(), 0.001);\n" +
				"		assertEquals(0, (int)test_regression_Dummy_0.getInt());\n" +
				"		assertEquals(0, (byte)test_regression_Dummy_0.getByte());\n" +
				"		assertEquals(false, (boolean)test_regression_Dummy_0.isBoolean());\n" +
				"		assertEquals('\\u0000', (char)test_regression_Dummy_0.getChar());\n" +
				"		assertNull(test_regression_Dummy_0.getString());\n" +
				"		assertEquals(0l, (long)test_regression_Dummy_0.getLong());\n" +
				"		assertEquals(1.0, (float)test_regression_Dummy_0.getFloat(), 0.001);\n" +
				"\n" +
				"		float tmp0 = test_regression_Dummy_0.getFloat();\n" +
				"		assertEquals(1.0, tmp0, 0.001);\n" +
				"		assertEquals(0, (short)test_regression_Dummy_0.getShort());\n" +
				"		assertEquals(0.0, (double)test_regression_Dummy_0.getDouble(), 0.001);\n" +
				"		assertEquals(0, (int)test_regression_Dummy_0.getInt());\n" +
				"		assertEquals(0, (byte)test_regression_Dummy_0.getByte());\n" +
				"		assertEquals(false, (boolean)test_regression_Dummy_0.isBoolean());\n" +
				"		assertEquals('\\u0000', (char)test_regression_Dummy_0.getChar());\n" +
				"		assertNull(test_regression_Dummy_0.getString());\n" +
				"		assertEquals(0l, (long)test_regression_Dummy_0.getLong());\n" +
				"		assertEquals(1.0, (float)test_regression_Dummy_0.getFloat(), 0.001);\n" +
				"\n" +
				"	}\n" +
				"}\n\n",
				readFile(new File(genDir, "test/regression/Dummy_TestCase.java"))
		);
	}

	public void testDouble() throws Exception {
		TestRegressionDummyCUT cut = new TestRegressionDummyCUT();
		Test test = new Test(cut.cluster, cut.refFactory, new Operation[] {
				new CreateObject(cut.cuts[0], cut.cns, new Reference[] { }),

				new AssignPrimitive(cut.doubles[0], 1.0),
				new Invoke(null, cut.cuts[0], cut.setDouble, new Reference[] { cut.doubles[0] }),

				new Invoke(cut.doubles[1], cut.cuts[0], cut.getDouble, new Reference[] { })
		});

		OperationResult.insert(test.getTest());
		OperationResultTestExecutor.execute(getFinder(), test, true);

		assertEquals(4, test.getTest().length);
		verifySuccessful(test.getTest()[0], null, new Entry[] {
			new SimpleEntry<String, Serializable>("isBoolean", false),
			new SimpleEntry<String, Serializable>("getByte", (byte) 0),
			new SimpleEntry<String, Serializable>("getChar", (char) 0),
			new SimpleEntry<String, Serializable>("getShort", (short) 0),
			new SimpleEntry<String, Serializable>("getInt", 0),
			new SimpleEntry<String, Serializable>("getLong", (long) 0),
			new SimpleEntry<String, Serializable>("getFloat", (float) 0),
			new SimpleEntry<String, Serializable>("getDouble", (double) 0),
			new SimpleEntry<String, Serializable>("getString", null),
		});

		assertNull(test.getTest()[1].getInfo(OperationResult.KEY));
		verifySuccessful(test.getTest()[2], new Entry[] {
			new SimpleEntry<String, Serializable>("isBoolean", false),
			new SimpleEntry<String, Serializable>("getByte", (byte) 0),
			new SimpleEntry<String, Serializable>("getChar", (char) 0),
			new SimpleEntry<String, Serializable>("getShort", (short) 0),
			new SimpleEntry<String, Serializable>("getInt", 0),
			new SimpleEntry<String, Serializable>("getLong", (long) 0),
			new SimpleEntry<String, Serializable>("getFloat", (float) 0),
			new SimpleEntry<String, Serializable>("getDouble", 1.0),
			new SimpleEntry<String, Serializable>("getString", null),
		}, null);

		verifySuccessful(test.getTest()[3], new Entry[] {
			new SimpleEntry<String, Serializable>("isBoolean", false),
			new SimpleEntry<String, Serializable>("getByte", (byte) 0),
			new SimpleEntry<String, Serializable>("getChar", (char) 0),
			new SimpleEntry<String, Serializable>("getShort", (short) 0),
			new SimpleEntry<String, Serializable>("getInt", 0),
			new SimpleEntry<String, Serializable>("getLong", (long) 0),
			new SimpleEntry<String, Serializable>("getFloat", (float) 0),
			new SimpleEntry<String, Serializable>("getDouble", 1.0),
			new SimpleEntry<String, Serializable>("getString", null),
		}, 1.0);

		JUnitTestGenerator junit = new JUnitTestGenerator(genDir, new RemoteClassLoader(getFinder()), false);
		junit.read("foo", test);
		junit.writeSuite();

		assertEquals("package test.regression;\n" +
				"\n" +
				"/** Test Generated by TestFul */\n" +
				"public class Dummy_TestCase extends junit.framework.TestCase {\n" +
				"\n" +
				"	// Binary test: foo\n" +
				"	public void testFul1() throws Exception {\n" +
				"\n" +
				"		java.lang.Double java_lang_Double_0 = null, java_lang_Double_1 = null;\n" +
				"		test.regression.Dummy test_regression_Dummy_0 = null;\n" +
				"\n" +
				"		java_lang_Double_0 = (double)1.0;\n" +
				"		test_regression_Dummy_0 = new test.regression.Dummy();\n" +
				"		assertEquals(0, (short)test_regression_Dummy_0.getShort());\n" +
				"		assertEquals(0.0, (double)test_regression_Dummy_0.getDouble(), 0.001);\n" +
				"		assertEquals(0, (int)test_regression_Dummy_0.getInt());\n" +
				"		assertEquals(0, (byte)test_regression_Dummy_0.getByte());\n" +
				"		assertEquals(false, (boolean)test_regression_Dummy_0.isBoolean());\n" +
				"		assertEquals('\\u0000', (char)test_regression_Dummy_0.getChar());\n" +
				"		assertNull(test_regression_Dummy_0.getString());\n" +
				"		assertEquals(0l, (long)test_regression_Dummy_0.getLong());\n" +
				"		assertEquals(0.0, (float)test_regression_Dummy_0.getFloat(), 0.001);\n" +
				"\n" +
				"		test_regression_Dummy_0.setDouble(java_lang_Double_0);\n" +
				"		assertEquals(0, (short)test_regression_Dummy_0.getShort());\n" +
				"		assertEquals(1.0, (double)test_regression_Dummy_0.getDouble(), 0.001);\n" +
				"		assertEquals(0, (int)test_regression_Dummy_0.getInt());\n" +
				"		assertEquals(0, (byte)test_regression_Dummy_0.getByte());\n" +
				"		assertEquals(false, (boolean)test_regression_Dummy_0.isBoolean());\n" +
				"		assertEquals('\\u0000', (char)test_regression_Dummy_0.getChar());\n" +
				"		assertNull(test_regression_Dummy_0.getString());\n" +
				"		assertEquals(0l, (long)test_regression_Dummy_0.getLong());\n" +
				"		assertEquals(0.0, (float)test_regression_Dummy_0.getFloat(), 0.001);\n" +
				"\n" +
				"		double tmp0 = test_regression_Dummy_0.getDouble();\n" +
				"		assertEquals(1.0, tmp0, 0.001);\n" +
				"		assertEquals(0, (short)test_regression_Dummy_0.getShort());\n" +
				"		assertEquals(1.0, (double)test_regression_Dummy_0.getDouble(), 0.001);\n" +
				"		assertEquals(0, (int)test_regression_Dummy_0.getInt());\n" +
				"		assertEquals(0, (byte)test_regression_Dummy_0.getByte());\n" +
				"		assertEquals(false, (boolean)test_regression_Dummy_0.isBoolean());\n" +
				"		assertEquals('\\u0000', (char)test_regression_Dummy_0.getChar());\n" +
				"		assertNull(test_regression_Dummy_0.getString());\n" +
				"		assertEquals(0l, (long)test_regression_Dummy_0.getLong());\n" +
				"		assertEquals(0.0, (float)test_regression_Dummy_0.getFloat(), 0.001);\n" +
				"\n" +
				"	}\n" +
				"}\n\n",
				readFile(new File(genDir, "test/regression/Dummy_TestCase.java"))
		);
	}

	public void testString() throws Exception {
		TestRegressionDummyCUT cut = new TestRegressionDummyCUT();
		Test test = new Test(cut.cluster, cut.refFactory, new Operation[] {
				new CreateObject(cut.cuts[0], cut.cns, new Reference[] { }),

				new AssignPrimitive(cut.strings[0], "foo"),
				new Invoke(null, cut.cuts[0], cut.setString, new Reference[] { cut.strings[0] }),

				new Invoke(cut.strings[1], cut.cuts[0], cut.getString, new Reference[] { })
		});

		OperationResult.insert(test.getTest());
		OperationResultTestExecutor.execute(getFinder(), test, true);

		assertEquals(4, test.getTest().length);
		verifySuccessful(test.getTest()[0], null, new Entry[] {
			new SimpleEntry<String, Serializable>("isBoolean", false),
			new SimpleEntry<String, Serializable>("getByte", (byte) 0),
			new SimpleEntry<String, Serializable>("getChar", (char) 0),
			new SimpleEntry<String, Serializable>("getShort", (short) 0),
			new SimpleEntry<String, Serializable>("getInt", 0),
			new SimpleEntry<String, Serializable>("getLong", (long) 0),
			new SimpleEntry<String, Serializable>("getFloat", (float) 0),
			new SimpleEntry<String, Serializable>("getDouble", (double) 0),
			new SimpleEntry<String, Serializable>("getString", null),
		});

		assertNull(test.getTest()[1].getInfo(OperationResult.KEY));
		verifySuccessful(test.getTest()[2], new Entry[] {
			new SimpleEntry<String, Serializable>("isBoolean", false),
			new SimpleEntry<String, Serializable>("getByte", (byte) 0),
			new SimpleEntry<String, Serializable>("getChar", (char) 0),
			new SimpleEntry<String, Serializable>("getShort", (short) 0),
			new SimpleEntry<String, Serializable>("getInt", 0),
			new SimpleEntry<String, Serializable>("getLong", (long) 0),
			new SimpleEntry<String, Serializable>("getFloat", (float) 0),
			new SimpleEntry<String, Serializable>("getDouble", (double) 0),
			new SimpleEntry<String, Serializable>("getString", "foo"),
		}, null);

		verifySuccessful(test.getTest()[3], new Entry[] {
			new SimpleEntry<String, Serializable>("isBoolean", false),
			new SimpleEntry<String, Serializable>("getByte", (byte) 0),
			new SimpleEntry<String, Serializable>("getChar", (char) 0),
			new SimpleEntry<String, Serializable>("getShort", (short) 0),
			new SimpleEntry<String, Serializable>("getInt", 0),
			new SimpleEntry<String, Serializable>("getLong", (long) 0),
			new SimpleEntry<String, Serializable>("getFloat", (float) 0),
			new SimpleEntry<String, Serializable>("getDouble", (double) 0),
			new SimpleEntry<String, Serializable>("getString", "foo"),
		}, "foo");

		JUnitTestGenerator junit = new JUnitTestGenerator(genDir, new RemoteClassLoader(getFinder()), false);
		junit.read("foo", test);
		junit.writeSuite();

		assertEquals("package test.regression;\n" +
				"\n" +
				"/** Test Generated by TestFul */\n" +
				"public class Dummy_TestCase extends junit.framework.TestCase {\n" +
				"\n" +
				"	// Binary test: foo\n" +
				"	public void testFul1() throws Exception {\n" +
				"\n" +
				"		java.lang.String java_lang_String_0 = null, java_lang_String_1 = null;\n" +
				"		test.regression.Dummy test_regression_Dummy_0 = null;\n" +
				"\n" +
				"		java_lang_String_0 = \"foo\";\n" +
				"		test_regression_Dummy_0 = new test.regression.Dummy();\n" +
				"		assertEquals(0, (short)test_regression_Dummy_0.getShort());\n" +
				"		assertEquals(0.0, (double)test_regression_Dummy_0.getDouble(), 0.001);\n" +
				"		assertEquals(0, (int)test_regression_Dummy_0.getInt());\n" +
				"		assertEquals(0, (byte)test_regression_Dummy_0.getByte());\n" +
				"		assertEquals(false, (boolean)test_regression_Dummy_0.isBoolean());\n" +
				"		assertEquals('\\u0000', (char)test_regression_Dummy_0.getChar());\n" +
				"		assertNull(test_regression_Dummy_0.getString());\n" +
				"		assertEquals(0l, (long)test_regression_Dummy_0.getLong());\n" +
				"		assertEquals(0.0, (float)test_regression_Dummy_0.getFloat(), 0.001);\n" +
				"\n" +
				"		test_regression_Dummy_0.setString(java_lang_String_0);\n" +
				"		assertEquals(0, (short)test_regression_Dummy_0.getShort());\n" +
				"		assertEquals(0.0, (double)test_regression_Dummy_0.getDouble(), 0.001);\n" +
				"		assertEquals(0, (int)test_regression_Dummy_0.getInt());\n" +
				"		assertEquals(0, (byte)test_regression_Dummy_0.getByte());\n" +
				"		assertEquals(false, (boolean)test_regression_Dummy_0.isBoolean());\n" +
				"		assertEquals('\\u0000', (char)test_regression_Dummy_0.getChar());\n" +
				"		assertEquals(\"foo\", test_regression_Dummy_0.getString());\n" +
				"		assertEquals(0l, (long)test_regression_Dummy_0.getLong());\n" +
				"		assertEquals(0.0, (float)test_regression_Dummy_0.getFloat(), 0.001);\n" +
				"\n" +
				"		java.lang.String tmp0 = test_regression_Dummy_0.getString();\n" +
				"		assertEquals(\"foo\", tmp0);\n" +
				"		assertEquals(0, (short)test_regression_Dummy_0.getShort());\n" +
				"		assertEquals(0.0, (double)test_regression_Dummy_0.getDouble(), 0.001);\n" +
				"		assertEquals(0, (int)test_regression_Dummy_0.getInt());\n" +
				"		assertEquals(0, (byte)test_regression_Dummy_0.getByte());\n" +
				"		assertEquals(false, (boolean)test_regression_Dummy_0.isBoolean());\n" +
				"		assertEquals('\\u0000', (char)test_regression_Dummy_0.getChar());\n" +
				"		assertEquals(\"foo\", test_regression_Dummy_0.getString());\n" +
				"		assertEquals(0l, (long)test_regression_Dummy_0.getLong());\n" +
				"		assertEquals(0.0, (float)test_regression_Dummy_0.getFloat(), 0.001);\n" +
				"\n" +
				"	}\n" +
				"}\n\n",
				readFile(new File(genDir, "test/regression/Dummy_TestCase.java"))
		);
	}

	public void testDummy() throws Exception {
		TestRegressionDummyCUT cut = new TestRegressionDummyCUT();
		Test test = new Test(cut.cluster, cut.refFactory, new Operation[] {
				new CreateObject(cut.cuts[0], cut.cns, new Reference[] { }),

				new AssignPrimitive(cut.ints[0], 1),
				new Invoke(null, cut.cuts[0], cut.setInt, new Reference[] { cut.ints[0] }),

				new CreateObject(cut.cuts[1], cut.cns, new Reference[] { }),
				new Invoke(null, cut.cuts[1], cut.setDummy, new Reference[] { cut.cuts[0] }),

				new Invoke(null, cut.cuts[1], cut.getDummy, new Reference[] { }),
		});

		OperationResult.insert(test.getTest());
		OperationResultTestExecutor.execute(getFinder(), test, true);

		assertEquals(6, test.getTest().length);
		verifySuccessful(test.getTest()[0], null, new Entry[] {
			new SimpleEntry<String, Serializable>("isBoolean", false),
			new SimpleEntry<String, Serializable>("getByte", (byte) 0),
			new SimpleEntry<String, Serializable>("getChar", (char) 0),
			new SimpleEntry<String, Serializable>("getShort", (short) 0),
			new SimpleEntry<String, Serializable>("getInt", 0),
			new SimpleEntry<String, Serializable>("getLong", (long) 0),
			new SimpleEntry<String, Serializable>("getFloat", (float) 0),
			new SimpleEntry<String, Serializable>("getDouble", (double) 0),
			new SimpleEntry<String, Serializable>("getString", null),
		});

		assertNull(test.getTest()[1].getInfo(OperationResult.KEY));

		verifySuccessful(test.getTest()[2], new Entry[] {
			new SimpleEntry<String, Serializable>("isBoolean", false),
			new SimpleEntry<String, Serializable>("getByte", (byte) 0),
			new SimpleEntry<String, Serializable>("getChar", (char) 0),
			new SimpleEntry<String, Serializable>("getShort", (short) 0),
			new SimpleEntry<String, Serializable>("getInt", 1),
			new SimpleEntry<String, Serializable>("getLong", (long) 0),
			new SimpleEntry<String, Serializable>("getFloat", (float) 0),
			new SimpleEntry<String, Serializable>("getDouble", (double) 0),
			new SimpleEntry<String, Serializable>("getString", null),
		}, null);

		verifySuccessful(test.getTest()[3], null, new Entry[] {
			new SimpleEntry<String, Serializable>("isBoolean", false),
			new SimpleEntry<String, Serializable>("getByte", (byte) 0),
			new SimpleEntry<String, Serializable>("getChar", (char) 0),
			new SimpleEntry<String, Serializable>("getShort", (short) 0),
			new SimpleEntry<String, Serializable>("getInt", 0),
			new SimpleEntry<String, Serializable>("getLong", (long) 0),
			new SimpleEntry<String, Serializable>("getFloat", (float) 0),
			new SimpleEntry<String, Serializable>("getDouble", (double) 0),
			new SimpleEntry<String, Serializable>("getString", null),
		});

		verifySuccessful(test.getTest()[4], new Entry[] {
			new SimpleEntry<String, Serializable>("isBoolean", false),
			new SimpleEntry<String, Serializable>("getByte", (byte) 0),
			new SimpleEntry<String, Serializable>("getChar", (char) 0),
			new SimpleEntry<String, Serializable>("getShort", (short) 0),
			new SimpleEntry<String, Serializable>("getInt", 0),
			new SimpleEntry<String, Serializable>("getLong", (long) 0),
			new SimpleEntry<String, Serializable>("getFloat", (float) 0),
			new SimpleEntry<String, Serializable>("getDouble", (double) 0),
			new SimpleEntry<String, Serializable>("getString", null),
		}, null);

		verifySuccessful(test.getTest()[5], new Entry[] {
			new SimpleEntry<String, Serializable>("isBoolean", false),
			new SimpleEntry<String, Serializable>("getByte", (byte) 0),
			new SimpleEntry<String, Serializable>("getChar", (char) 0),
			new SimpleEntry<String, Serializable>("getShort", (short) 0),
			new SimpleEntry<String, Serializable>("getInt", 0),
			new SimpleEntry<String, Serializable>("getLong", (long) 0),
			new SimpleEntry<String, Serializable>("getFloat", (float) 0),
			new SimpleEntry<String, Serializable>("getDouble", (double) 0),
			new SimpleEntry<String, Serializable>("getString", null),
		}, new Entry[] {
			new SimpleEntry<String, Serializable>("isBoolean", false),
			new SimpleEntry<String, Serializable>("getByte", (byte) 0),
			new SimpleEntry<String, Serializable>("getChar", (char) 0),
			new SimpleEntry<String, Serializable>("getShort", (short) 0),
			new SimpleEntry<String, Serializable>("getInt", 1),
			new SimpleEntry<String, Serializable>("getLong", (long) 0),
			new SimpleEntry<String, Serializable>("getFloat", (float) 0),
			new SimpleEntry<String, Serializable>("getDouble", (double) 0),
			new SimpleEntry<String, Serializable>("getString", null),
		});

		JUnitTestGenerator junit = new JUnitTestGenerator(genDir, new RemoteClassLoader(getFinder()), false);
		junit.read("foo", test);
		junit.writeSuite();

		assertEquals("package test.regression;\n" +
				"\n" +
				"/** Test Generated by TestFul */\n" +
				"public class Dummy_TestCase extends junit.framework.TestCase {\n" +
				"\n" +
				"	// Binary test: foo\n" +
				"	public void testFul1() throws Exception {\n" +
				"\n" +
				"		java.lang.Integer java_lang_Integer_0 = null;\n" +
				"		test.regression.Dummy test_regression_Dummy_0 = null, test_regression_Dummy_1 = null;\n" +
				"\n" +
				"		java_lang_Integer_0 = (int)1;\n" +
				"		test_regression_Dummy_0 = new test.regression.Dummy();\n" +
				"		assertEquals(0, (short)test_regression_Dummy_0.getShort());\n" +
				"		assertEquals(0.0, (double)test_regression_Dummy_0.getDouble(), 0.001);\n" +
				"		assertEquals(0, (int)test_regression_Dummy_0.getInt());\n" +
				"		assertEquals(0, (byte)test_regression_Dummy_0.getByte());\n" +
				"		assertEquals(false, (boolean)test_regression_Dummy_0.isBoolean());\n" +
				"		assertEquals('\\u0000', (char)test_regression_Dummy_0.getChar());\n" +
				"		assertNull(test_regression_Dummy_0.getString());\n" +
				"		assertEquals(0l, (long)test_regression_Dummy_0.getLong());\n" +
				"		assertEquals(0.0, (float)test_regression_Dummy_0.getFloat(), 0.001);\n" +
				"\n" +
				"		test_regression_Dummy_1 = new test.regression.Dummy();\n" +
				"		assertEquals(0, (short)test_regression_Dummy_1.getShort());\n" +
				"		assertEquals(0.0, (double)test_regression_Dummy_1.getDouble(), 0.001);\n" +
				"		assertEquals(0, (int)test_regression_Dummy_1.getInt());\n" +
				"		assertEquals(0, (byte)test_regression_Dummy_1.getByte());\n" +
				"		assertEquals(false, (boolean)test_regression_Dummy_1.isBoolean());\n" +
				"		assertEquals('\\u0000', (char)test_regression_Dummy_1.getChar());\n" +
				"		assertNull(test_regression_Dummy_1.getString());\n" +
				"		assertEquals(0l, (long)test_regression_Dummy_1.getLong());\n" +
				"		assertEquals(0.0, (float)test_regression_Dummy_1.getFloat(), 0.001);\n" +
				"\n" +
				"		test_regression_Dummy_0.setInt(java_lang_Integer_0);\n" +
				"		assertEquals(0, (short)test_regression_Dummy_0.getShort());\n" +
				"		assertEquals(0.0, (double)test_regression_Dummy_0.getDouble(), 0.001);\n" +
				"		assertEquals(1, (int)test_regression_Dummy_0.getInt());\n" +
				"		assertEquals(0, (byte)test_regression_Dummy_0.getByte());\n" +
				"		assertEquals(false, (boolean)test_regression_Dummy_0.isBoolean());\n" +
				"		assertEquals('\\u0000', (char)test_regression_Dummy_0.getChar());\n" +
				"		assertNull(test_regression_Dummy_0.getString());\n" +
				"		assertEquals(0l, (long)test_regression_Dummy_0.getLong());\n" +
				"		assertEquals(0.0, (float)test_regression_Dummy_0.getFloat(), 0.001);\n" +
				"\n" +
				"		test_regression_Dummy_1.setDummy(test_regression_Dummy_0);\n" +
				"		assertEquals(0, (short)test_regression_Dummy_1.getShort());\n" +
				"		assertEquals(0.0, (double)test_regression_Dummy_1.getDouble(), 0.001);\n" +
				"		assertEquals(0, (int)test_regression_Dummy_1.getInt());\n" +
				"		assertEquals(0, (byte)test_regression_Dummy_1.getByte());\n" +
				"		assertEquals(false, (boolean)test_regression_Dummy_1.isBoolean());\n" +
				"		assertEquals('\\u0000', (char)test_regression_Dummy_1.getChar());\n" +
				"		assertNull(test_regression_Dummy_1.getString());\n" +
				"		assertEquals(0l, (long)test_regression_Dummy_1.getLong());\n" +
				"		assertEquals(0.0, (float)test_regression_Dummy_1.getFloat(), 0.001);\n" +
				"\n" +
				"		test.regression.Dummy tmp0 = test_regression_Dummy_1.getDummy();\n" +
				// assertions on the return value
				"		assertNotNull(tmp0);\n" +
				"		assertEquals(0, (short)tmp0.getShort());\n" +
				"		assertEquals(0.0, (double)tmp0.getDouble(), 0.001);\n" +
				"		assertEquals(1, (int)tmp0.getInt());\n" +
				"		assertEquals(0, (byte)tmp0.getByte());\n" +
				"		assertEquals(false, (boolean)tmp0.isBoolean());\n" +
				"		assertEquals('\\u0000', (char)tmp0.getChar());\n" +
				"		assertNull(tmp0.getString());\n" +
				"		assertEquals(0l, (long)tmp0.getLong());\n" +
				"		assertEquals(0.0, (float)tmp0.getFloat(), 0.001);\n" +
				// assertions on the object status
				"		assertEquals(0, (short)test_regression_Dummy_1.getShort());\n" +
				"		assertEquals(0.0, (double)test_regression_Dummy_1.getDouble(), 0.001);\n" +
				"		assertEquals(0, (int)test_regression_Dummy_1.getInt());\n" +
				"		assertEquals(0, (byte)test_regression_Dummy_1.getByte());\n" +
				"		assertEquals(false, (boolean)test_regression_Dummy_1.isBoolean());\n" +
				"		assertEquals('\\u0000', (char)test_regression_Dummy_1.getChar());\n" +
				"		assertNull(test_regression_Dummy_1.getString());\n" +
				"		assertEquals(0l, (long)test_regression_Dummy_1.getLong());\n" +
				"		assertEquals(0.0, (float)test_regression_Dummy_1.getFloat(), 0.001);\n" +
				"\n" +
				"	}\n" +
				"}\n\n",
				readFile(new File(genDir, "test/regression/Dummy_TestCase.java"))
		);
	}

	private final String readFile(File file) throws IOException {
		assertTrue(file.exists());
		assertTrue(file.canRead());

		Reader r = new FileReader(file);
		StringBuilder sb = new StringBuilder();

		try {

			int len;
			char[] buffer = new char[1024];
			while((len = r.read(buffer)) > 0)
				sb.append(buffer, 0, len);

		} finally {
			r.close();
		}

		return sb.toString();
	}

	private void verifySuccessful(Operation op, Serializable object, Serializable result) {
		OperationResult operationResult = (OperationResult)op.getInfo(OperationResult.KEY);

		assertNotNull(operationResult);
		assertEquals(OperationResult.Status.SUCCESSFUL, operationResult.getStatus());

		Value obj = operationResult.getObject();
		assertNotNull(obj);
		if(object == null) {
			assertTrue(obj.isNull());
		} else {
			assertFalse(obj.isNull());

			if(object instanceof Entry[]) {
				Entry<String, Serializable>[] entry = (Entry<String, Serializable>[]) object;
				assertEquals(entry.length, obj.getObservers().size());
				for (Entry<String, Serializable> e : entry)
					assertEquals(e.getValue(), obj.getObserver(e.getKey()));
			} else {
				assertEquals(object.getClass().getName(), obj.getType());
				assertEquals(object, obj.getObject());
			}
		}

		Value res = operationResult.getResult();
		assertNotNull(res);
		if(result == null) {
			assertTrue(res.isNull());
		} else {
			assertFalse(res.isNull());

			if(result instanceof Entry[]) {
				Entry<String, Serializable>[] entry = (Entry<String, Serializable>[]) result;
				assertEquals(entry.length, res.getObservers().size());
				for (Entry<String, Serializable> e : entry)
					assertEquals(e.getValue(), res.getObserver(e.getKey()));
			} else {
				assertEquals(result.getClass().getName(), res.getType());
				assertEquals(result, res.getObject());
			}
		}
	}

	private static void delete(File f) throws IOException {
		if (f.isDirectory()) {
			for (File c : f.listFiles())
				delete(c);
		}

		if (!f.delete())
			throw new FileNotFoundException("Failed to delete file: " + f);
	}
}
